home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / kaos_install < prev    next >
Encoding:
Text File  |  1990-01-28  |  12.9 KB  |  491 lines

  1. #!/bin/csh
  2. echo '################################################################'
  3. echo '                kaos installation script'
  4. echo ''
  5. echo ' written by Swan Kim 5/1989, modified by Swan Kim 8/89,1/90'
  6. echo '################################################################'
  7. echo ' The existence of the file "installcap" is important.'
  8. echo ' Do NOT edit this file unless you are quite sure of'
  9. echo ' how installcap works.'
  10. echo ' The configuration in the file "installcap" should be'
  11. echo ' consistent with configuration in the kaos source.'
  12. echo ' NOTE: The directory $KAOSHOME/bin should be included into'
  13. echo ' your search path. See the "README" file in the directory'
  14. echo ' $KAOSHOME and follow instructions there.'
  15. echo ''
  16. echo '   Step 1: install a kaos home directory'
  17. echo '   Step 2: install a version number of SunOS'
  18. echo '   Step 3: install a local printer name'
  19. echo '   Step 4: install a floating point coprocessor type'
  20. echo '   Step 5: install a math library type'
  21. echo '   Step 6: make kaos programs'
  22. echo ''
  23. echo "Answers should be given by either of [[y,yes]]/n,no/s,skip"
  24. echo "where the default is enclosed in [[ ]]."
  25. echo ''
  26.  
  27. set olduserhome = `grep USERHOME installcap | awk '{print $2}'`
  28. set oldkaoshome = `grep KAOSHOME installcap | awk '{print $2}'`
  29.  
  30. set oldsunos = `grep SUNOS installcap | awk '{print $2}'`
  31. set oldprintername = `grep PRINTER installcap | awk '{print $2}'`
  32. set printername = laser
  33. set oldfpflags = `grep FPFLAGS installcap | awk '{print $2}'`
  34. set fpflags = ${oldfpflags}
  35. set oldmathlibs = `grep MATHLIBS installcap | awk '{print $2}'`
  36. set mathlibs = -lm
  37.  
  38. set makefiles = `ls ${oldkaoshome}/Makefile ${oldkaoshome}/*lib/Makefile`
  39. set makefile =
  40.  
  41. set kaoshome =
  42.  
  43. echo '---------------------------------------------------------------'
  44. echo 'StepI: INSTALLATION OF KAOS HOME DIRECTORY'
  45. echo '---------------------------------------------------------------'
  46. echo 'OLD KAOS HOME DIRECTORY:'
  47. echo "   old login directory: ${olduserhome}"
  48. echo "   old kaos home directory: ${oldkaoshome}"
  49.  
  50. echo 'DEFAULT KAOS HOME DIRECTORY:'
  51. echo "   new login directory: ${HOME}"
  52. echo "   new kaos home directory: ${KAOSHOME}"
  53.  
  54. if (${KAOSHOME} == '') then
  55.     echo ' WARNING: The environmental variable KAOSHOME is not set.'
  56.     echo ' See the "README" file in the directory'
  57.     echo ' follow instructions there.'
  58.     echo ' Refer to the installation manual for details.'
  59.     exit -1
  60. endif
  61.  
  62. start_kaoshome_loop:
  63. echo "Do you want to use a new configuration?"
  64. echo "   Yes, go ahead./No, enter manually./Skip. Do nothing."
  65. echo -n "   [[[y]]/n/s]?? "
  66. set answer = $<
  67. switch ($answer)
  68. case 's*':
  69.     echo ''
  70.     echo Skipping this step ...
  71.     set kaoshome = ${oldkaoshome}
  72.     goto skip_kaoshome_loop
  73.     breaksw
  74. case '':
  75. case y*:
  76.     set kaoshome = $KAOSHOME
  77.     breaksw
  78. case n*:
  79.     echo ''
  80.     echo -n "kaos home directory: [$KAOSHOME] "
  81.     set answer = $<
  82.     switch ($answer)
  83.     case '':
  84.         breaksw
  85.     default:
  86.         set kaoshome = $answer
  87.         breaksw
  88.     endsw
  89.     breaksw
  90. default:
  91.     echo Error: Incorrect answer!
  92.     goto start_kaoshome_loop
  93.     breaksw
  94. endsw
  95.  
  96. echo ''
  97. echo Installing user and kaos home directories...
  98.  
  99. set oldtop = `echo ${oldkaoshome} | sed 's/\//\\\//g'`
  100. set top = `echo ${kaoshome} | sed 's/\//\\\//g'`
  101.  
  102. (cd ${kaoshome}; set libs = `ls -d *lib`; set lib = ; cd ..)
  103.  
  104. ${kaoshome}/bin/kedg "${oldtop}" "${top}" ${kaoshome}/include/main_kaos_init.h 
  105.  
  106. set makefiles = `ls ${kaoshome}/Makefile ${kaoshome}/*lib/Makefile`
  107. #foreach makefile ($makefiles)
  108. #    ${kaoshome}/bin/kedg "${oldtop}" "${top}" ${makefile}
  109. #end
  110.  
  111. echo -n Writing a new \"installcap\" file...
  112. cat > "${kaoshome}/installcap" <<END
  113. USERHOME ${HOME}
  114. KAOSHOME ${kaoshome}
  115. PRINTER ${oldprintername}
  116. SUNOS ${oldsunos}
  117. FPFLAGS ${oldfpflags}
  118. MATHLIBS ${oldmathlibs}
  119. END
  120. echo ...Writing Done!
  121.  
  122. skip_kaoshome_loop:
  123.  
  124. echo ''
  125. echo '---------------------------------------------------------------'
  126. echo Step2: Installation of the version number of SunOS...
  127. echo '---------------------------------------------------------------'
  128. echo "    OLD SUNOS VERSION NUMBER: ${oldsunos}."
  129. echo "Trying to find a version number of SunOS from /etc/motd..."
  130. set motdline = (`grep SunOS /etc/motd`)
  131. echo "Found the following:"
  132. echo "   ${motdline}"
  133. if (${motdline[1]} == '') then
  134.     echo ''
  135.     echo Error: Version number of SunOS not found! Specify manually!
  136.     goto manual_sunos_loop
  137. else
  138.     set next = off
  139.     foreach word ($motdline)
  140.         if ( $next == 'on' ) then
  141.             set sunos = $word
  142.             break
  143.         endif    
  144.         if ( $word == 'Release' ) then
  145.             set next = on
  146.         endif
  147.     end
  148. endif
  149.  
  150. if( $oldsunos == $sunos) then
  151.     echo The new SunOS version number is the same as the old one.
  152.     echo Skipping this step...
  153.     goto skip_sunos_loop
  154. endif
  155.  
  156. start_sunos_loop:
  157.  
  158. echo "    NEW VERSION NUMBER OF SUNOS: ${sunos}."
  159. switch(${sunos})
  160. case '3.2*':
  161.     echo kaos can not run under SunOS 3.2.
  162.     echo Update the operating system to SunOS 4.0 or higher!
  163. case '3.5*':
  164.     echo Warning: kaos can be run under SunOS 3.5 only after
  165.     echo modest efforts. Evern after successful installation,
  166.     echo its performance is severely limited. The best solution is
  167.     echo updating SunOS to 4.0 or later.
  168.     echo -n "Do you still want to go ahead with installation??"
  169.     set answer = $<
  170.     switch($answer)
  171.     case 'y*':
  172.         breaksw
  173.     case 'n*':
  174.         exit 0
  175.         breaksw
  176.     endsw
  177.     cat > "${kaoshome}/include/sunos_kaos_def.h" <<END
  178. #define SUNOS4 0
  179. END
  180.     breaksw
  181. case '':
  182. case '4.0*':
  183.     cat > "${kaoshome}/include/sunos_kaos_def.h" <<END
  184. #define SUNOS4 1
  185. END
  186.     breaksw
  187. case 's':
  188.     echo Skipping this step...
  189.     set sunos = ${oldsunos}
  190.     goto skip_sunos_loop
  191.     breaksw
  192. default:
  193.  
  194. manual_sunos_loop:
  195.     echo This version number of SunOS is not recognized.
  196.     echo -n "Enter the correct version number of SunOS:[s/3.2/3.5/[[4.0]]/4.0.1/4.0.3/4.0.3c]??"
  197.     set sunos = $<
  198.     if($sunos == 's' ) then
  199.         set sunos = ${oldsunos}
  200.     endif
  201.     goto start_sunos_loop
  202.     breaksw
  203. endsw
  204.  
  205. echo The SunOS version number is recognized and installed!
  206.  
  207. skip_sunos_loop:
  208.  
  209. echo ''
  210. echo '---------------------------------------------------------------'
  211. echo 'Step3: Installing laser printer name'
  212. echo '---------------------------------------------------------------'
  213. echo "    OLD LASER PRINTER NAME: ${oldprintername}"
  214. echo "    NEW LASER PRINTER NAME: ${printername}"
  215.  
  216. start_laser_loop:
  217. echo "Do you want to select a new laser printer name?"
  218. echo "   Yes, go ahead./No, enter manually./Skip. Retain old."
  219. echo -n "   [y/n/[[s]]]?? "
  220. set answer = $<
  221. switch ($answer)
  222. case '':
  223. case 's*':
  224.     set printername = ${oldprintername}
  225.     echo Skipping this step...
  226.     goto skip_laser_loop
  227.     breaksw
  228. case 'y*':
  229.     ${kaoshome}/bin/kedg "-P${oldprintername}" "-P${printername}" ${kaoshome}/include/main_kaos_init.h
  230.     breaksw
  231. case 'n*':
  232.     echo -n "Enter the name of the printer: [${oldprintername}]??"
  233.     set printername = $<
  234.     switch ($printername)
  235.     case '':
  236.         set printername = $oldprintername
  237.         breaksw
  238.     default:
  239.         breaksw
  240.     endsw
  241.     ${kaoshome}/bin/kedg "-P${oldprintername}" "-P${printername}" ${kaoshome}/include/main_kaos_init.h
  242.     breaksw
  243. default:
  244.     echo Incorrect answer!
  245.     goto start_laser_loop
  246.     breaksw
  247. endsw
  248.  
  249. echo Laser printer name installation done!
  250.  
  251. skip_laser_loop:
  252.  
  253. echo ''
  254. echo '---------------------------------------------------------------'
  255. echo Step4: Installation of the floating point accelerator type
  256. echo '---------------------------------------------------------------'
  257.  
  258. echo "    OLD FLOATING POINT FLAG: ${oldfpflags}"
  259.  
  260. set floating =
  261.  
  262. start_fp_loop:
  263. echo 'Choosing "automatic" determines a floating point flag'
  264. echo 'for a given architecture by using "foption."'
  265. echo "Do you want to install automatically?"
  266. echo "   Yes, go ahead./No, enter manually./Skip. Retain old."
  267. echo -n "   [y/n/[[s]]]??"
  268. set answer = $<
  269. switch($answer)
  270. case '':
  271. case 's*':
  272.     echo Skipping this step...
  273.     set fpflags = ${oldfpflags}
  274.     goto skip_fp_loop
  275.     breaksw
  276. case 'y*':
  277.     set floating = `/usr/etc/foption`
  278.     echo "foption is ${floating}"
  279.     switch($floating)
  280.     case '68881':
  281.     case 'soft':
  282.     case 'fpa':
  283.         echo 'Installing floating point flag...'
  284.         set fpflags = -f${floating}
  285.         foreach makefile ($makefiles)
  286.             ${kaoshome}/bin/kedg "${oldfpflags}" "${fpflags}" ${makefile}
  287.         end    
  288.         goto end_fp_loop
  289.         breaksw
  290.     case 'sun4':
  291.         echo 'Installing floating point flag...'
  292.         set fpflags = -${floating}
  293.         foreach makefile ($makefiles)
  294.             ${kaoshome}/bin/kedg "${oldfpflags}" "${fpflags}" ${makefile}
  295.         end    
  296.         goto end_fp_loop
  297.         breaksw
  298.     case 'foption':
  299.         echo "foption is not found. Specify the floating point coprocessor type."
  300.         goto manual_fp_option
  301.         breaksw
  302.     endsw
  303.     echo "foption is unable to recognize this floating point accelerator type ${floating}."
  304.     echo Specify the floating pointe coprocessor type.
  305.     goto manual_fp_option
  306.     breaksw
  307. case 'n*':
  308.     manual_fp_option:
  309.     echo Enter the floating point accelerator type:
  310.     echo -n "[[${oldfpflags}]/-f68881/-ffpa/-fsoft/-sun4]??"
  311.     set fpflags = $<
  312.     switch($fpflags)
  313.     case '':
  314.         set fpflags = ${oldfpflags}
  315.         foreach makefile ($makefiles)
  316.             ${kaoshome}/bin/kedg "${oldfpflags}" "${fpflags}" ${makefile}
  317.         end    
  318.         goto end_fp_loop
  319.         breaksw
  320.     case '-f68881':
  321.     case '-fsoft':
  322.     case '-ffpa':
  323.     case '-sun4':
  324.         foreach makefile ($makefiles)
  325.             ${kaoshome}/bin/kedg "${oldfpflags}" "${fpflags}" ${makefile}
  326.         end    
  327.         goto end_fp_loop
  328.         breaksw
  329.     endsw
  330.     echo "This floating point flag ${fpflags} is not recognized."
  331.     goto manual_fp_option
  332.     breaksw
  333. default:
  334.     echo Incorrect answer!
  335.     goto start_fp_loop
  336.     breaksw
  337. endsw
  338.  
  339. end_fp_loop:
  340. echo ...Installation Done!
  341.  
  342. skip_fp_loop:
  343.  
  344. echo ''
  345. echo '---------------------------------------------------------------'
  346. echo 'Step5: math library flag installation...'
  347. echo '---------------------------------------------------------------'
  348.  
  349. set sunosoldil = /usr/lib/f68881.il
  350. set sunosnewil = /usr/lib/f68881/libm.il
  351. switch($sunos)
  352. case '3.*':
  353.     set sunosil = ${sunosoldil}
  354.     breaksw
  355. case '4.*':
  356.     set sunosil = ${sunosnewil}
  357.     breaksw
  358. default:
  359.     echo "This version number of SunOS is not correct!"
  360.     exit -1
  361. endsw
  362.  
  363. echo 'The inline math library increase the performance'
  364. echo "at almost no cost: ${sunosil} is available."
  365.  
  366. echo "    OLD MATH LIBRARY FLAG: ${oldmathlibs}"
  367. echo "    NEW MATH LIBRARY FLAG: ${mathlibs}"
  368.  
  369. start_math_loop:
  370. echo "Do you want to select the new math library flag?"
  371. echo "   Yes, go ahead./No, enter manually./Skip. Retain old."
  372. echo -n "   [y/n/[[s]]]?? "
  373. set answer = $<
  374. switch($answer)
  375. case '':
  376. case 's*':
  377.     echo Skipping this step...
  378.     set mathlibs = ${oldmathlibs}
  379.     goto skip_math_loop
  380.     breaksw
  381. case 'n*':
  382.     breaksw
  383. case 'y*':
  384.     manual_math_option:
  385.     echo -n "Enter the math libary type:[[${oldmathlibs}]/[-lm]/[il,${sunosil}]]?? "
  386.     set mathlibs = $<
  387.     breaksw
  388. default:
  389.     echo Incorrect answer!
  390.     goto start_math_loop
  391.     breaksw
  392. endsw
  393.  
  394. switch($mathlibs)
  395. case '':
  396.     set mathlibs = $oldmathlibs
  397.     breaksw
  398. case '-lm':
  399.     set oldmath = `echo ${oldmathlibs} | sed 's/\//\\\\\\\//g'`
  400.     set math = `echo ${mathlibs} | sed 's/\//\\\\\\\//g'`
  401.     foreach makefile ($makefiles)
  402.         ${kaoshome}/bin/kedg "${oldmath}" "${math}" ${makefile}
  403.     end    
  404.     breaksw
  405. case 'il':
  406. case '${sunosil}':
  407.     set oldmath = `echo ${oldmathlibs} | sed 's/\//\\\\\\\//g'`
  408.     set math = `echo ${sunosil} | sed 's/\//\\\\\\\//g'`
  409.     foreach makefile ($makefiles)
  410.         ${kaoshome}/bin/kedg "${oldmath}" "${math}" ${makefile}
  411.     end    
  412.  
  413.     # leave the math option for binsrclib to be -lm
  414.     set math = `echo ${sunosil} | sed 's/\//\\\//g'`
  415.     ${kaoshome}/bin/kedg "${math}" "-lm" ${kaoshome}/binsrclib/Makefile
  416.     breaksw
  417. default:
  418.     echo "Error: This math library ${mathlibs} is not recognized."
  419.     goto manaual_math_option
  420.     breaksw
  421. endsw
  422.  
  423. echo ...math flag installation done!
  424.  
  425. skip_math_loop:
  426.  
  427. echo -n Writing a new \"installcap\" file...
  428. cat > "${kaoshome}/installcap" <<END
  429. USERHOME ${HOME}
  430. KAOSHOME ${kaoshome}
  431. PRINTER ${printername}
  432. SUNOS ${sunos}
  433. FPFLAGS ${fpflags}
  434. MATHLIBS ${mathlibs}
  435. END
  436. echo ... Done!
  437.  
  438. echo ''
  439. echo '---------------------------------------------------------------'
  440. echo Final Step: MAKING KAOS AND COMPANION PROGRAMS
  441. echo '---------------------------------------------------------------'
  442.  
  443. start_compile_loop:
  444. echo 'Is this first time installation? Make all executables for kaos?'
  445. echo "   Yes, make all./No, make main programs only./Skip."
  446. echo -n "   [y/n/[[s]]]?? "
  447. set answer = $<
  448. switch($answer)
  449. case '':
  450. case 's*':
  451.     echo Skipping compilation...
  452.     goto skip_compile_loop
  453.     breaksw
  454. case 'n*':
  455.     set makeprogram = kaos
  456.     breaksw
  457. case 'y*':
  458.     set makeprogram = all
  459.     breaksw
  460. default:
  461.     echo Error: Incorrect answer!
  462.     goto start_compile_loop
  463.     breaksw
  464. endsw
  465.  
  466. switch($sunos)
  467. case '3.*':
  468.     if ( $sunos != $oldsunos || '$fpflags' != '$oldfpflags' || '$mathlibs' != '$oldmathlibs' ) then
  469.         echo 'compiling all modules for libraries in the subdirectories...'
  470.         echo 'After initial installation, if SunOS, floating point, math library flags do not change'
  471.         echo "use make kaos to compile only necessary modules"
  472.         ${kaoshome}/bin/kmake
  473.     endif
  474.     (cd ${kaoshome}; make ${makeprogram})
  475.     breaksw
  476. case '4.*':
  477.     (cd ${kaoshome}; make ${makeprogram})
  478.     breaksw
  479. default:
  480.     echo The version number of SunOS is not acceptable!
  481.     echo Try to reinstall the version number of SunOS.
  482.     exit -1
  483. endsw
  484.  
  485. skip_compile_loop:
  486. echo ''
  487. echo "NOTE: kaos is installed in the directory ${kaoshome}"
  488. echo "If the compilation step is not skipped or there are no errors"
  489. echo "during compilation, try to run kaos by moving to"
  490. echo "the directory ${kaoshome} and typing kaos."
  491.